import 'package:freezed_annotation/freezed_annotation.dart';

import 'account_type.dart';

part 'point_transfer.freezed.dart';

part 'point_transfer.g.dart';

@freezed
abstract class PointTransferParam with _$PointTransferParam {
  factory PointTransferParam({
    List<AccountTypeItem> accountTypes,
    List<String> inUsernames,
  }) = _PointTransferParam;

  factory PointTransferParam.fromJson(Map<String, dynamic> json) =>
      _$PointTransferParamFromJson(json);
}

@freezed
abstract class AccountTypeItem with _$AccountTypeItem {
  factory AccountTypeItem({
    String name,
    AccountType accountType,
    double balance,
    String amountHint,
    bool needPassword,
    bool selected,
  }) = _AccountTypeItem;

  factory AccountTypeItem.fromJson(Map<String, dynamic> json) => _$AccountTypeItemFromJson(json);
}

@freezed
abstract class PointTransferReq with _$PointTransferReq {
  factory PointTransferReq({
    AccountType accountType,
    double amount,
    String note,
    String password,
    String username,
  }) = _PointTransferReq;

  factory PointTransferReq.fromJson(Map<String, dynamic> json) => _$PointTransferReqFromJson(json);
}

@freezed
abstract class PointTransferQueryParam with _$PointTransferQueryParam {
  factory PointTransferQueryParam({
    List<AccountTypeItem> accountTypes,
    List<String> inUsernames,
    List<String> outUsernames,
  }) = _PointTransferQueryParam;

  factory PointTransferQueryParam.fromJson(Map<String, dynamic> json) =>
      _$PointTransferQueryParamFromJson(json);
}

@freezed
abstract class PointTransferQueryReq with _$PointTransferQueryReq {
  factory PointTransferQueryReq({
    AccountType accountType,
    String inUsername,
    String outUsername,
    String startTime,
    String endTime,
    int pageIndex,
    int pageSize,
  }) = _PointTransferQueryReq;

  factory PointTransferQueryReq.fromJson(Map<String, dynamic> json) =>
      _$PointTransferQueryReqFromJson(json);
}

@freezed
abstract class PointTransferQueryRes with _$PointTransferQueryRes {
  factory PointTransferQueryRes({
    String statusText,
    List<PointTransferQueryItem> historyItems,
  }) = _PointTransferQueryRes;

  factory PointTransferQueryRes.fromJson(Map<String, dynamic> json) =>
      _$PointTransferQueryResFromJson(json);
}

@freezed
abstract class PointTransferQueryItem with _$PointTransferQueryItem {
  factory PointTransferQueryItem({
    AccountType accountType,
    String accountTypeName,
    String amount,
    String createTime,
    String inUsername,
    String note,
    String outUsername,
    String transferFlag,
  }) = _PointTransferQueryItem;

  factory PointTransferQueryItem.fromJson(Map<String, dynamic> json) =>
      _$PointTransferQueryItemFromJson(json);
}
